﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NewGlobalBizAssist
{
    public partial class DirectEarning : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void find_click(object sender, Lib.FindUpdateEventArgs e)
        {

            lblnorec.Visible = false;
            Lib.Member mem = new Lib.Member();
            DataRow dr = mem.GetMemberInfo(e.SelectedValue);
            lblname.Text = dr["LastName"].ToString() + ", " + dr["FirstName"].ToString() + " ";
            if (dr["MiddleName"] != null)
                lblname.Text += dr["MiddleName"].ToString() + (dr["MiddleName"].ToString().Length == 1 ? "." : "");

            DataSet ds = mem.GetDirectEarning(e.SelectedValue);
            if (ds != null)
            {
                gvMembers.DataSource = ds;
                gvMembers.DataBind();
                lblnorec.Visible = (ds.Tables[0].Rows.Count == 0);
            }
            else
                lblnorec.Visible = true;
        }
    }
}